package top.healthylife.gateway.platform.bank.dto.business.req;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import top.healthylife.gateway.dto.request.req.ApiReqDto;

/**
 * @author : GaoZeXi
 * @date 2021/8/13 17:46
 */
@Data
@Accessors(chain = true)
@ApiModel("企业征信单笔查询接口")
public class BankReqBusinessCreditReportSingleDto extends ApiReqDto {
    @ApiModelProperty(value = "交易代码", notes = "T00220001",example = "T00220001", required = true)
    private String transCode;
    @ApiModelProperty(value = "业务系统编码",example = "CMS", notes = "业务系统编码：信贷系统：CMS 决策管理平台：DCM", required = true)
    private String sysId;
    @ApiModelProperty(value = "被查询企业名称",example = "重庆进出口融资担保有限公司", notes = "被查询企业名称", required = true)
    private String entName;
    /**
     * 证件类型 传枚举中的数字 数字 企业登记注册类型代码表"
     * <li>10:中征码（原贷款卡编码）
     * <li>20:统一社会信用代码
     * <li>30:组织机构代码
     * <li>01:工商注册号
     * <li>02:机关和事业单位登记号
     * <li>03:社会团体登记号
     * <li>04:民办非企业登记号
     * <li>05:基金会登记号
     * <li>06:宗教证书登记号
     * <li>07:律师事务所执业许可证号
     * <li>08:司法鉴定许可证号
     * <li>41:纳税人识别号（国税）
     * <li>42:纳税人识别号（地税
     */
    @ApiModelProperty(value = "被查询企业证件类型",example = "20", notes = "被查询企业证件类型", required = true)
    private String entCertType;
    @ApiModelProperty(value = "被查询企业证件号码",example = "91500000683925570T", notes = "被查询企业证件号码", required = true)
    private String entCertNum;
    /**
     * 原因传数字
     * 企业信用报告查询原因代码表
     * <li>01:贷前（保前）审查
     * <li>02:贷中操作
     * <li>03:贷后（在保） 管理
     * <li>04:其他原因
     * <li>05:关联查询
     * <li>17:额度审批
     * <li>18:担保审查
     *
     */
    @ApiModelProperty(value = "查询原因",example = "01", notes = "金融机构查询信用报告的原因", required = true)
    private String queryReason;

    @ApiModelProperty(value = "xml模板", notes = "http请求的xml模板", required = false, hidden = true)
    static String templateXMl =
            "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://service.webservice.credit2query.zxjk.com/\">\n" +
            "   <soapenv:Header/>\n" +
            "   <soapenv:Body>\n" +
            "      <ser:rtdsRequest>\n" +
            "         <RtdsRequest>\n" +
            "            <transCode>{transCode}</transCode>\n" +
            "            <sysId>{sysId}</sysId>\n" +
            "            <userId>{sysUserId}</userId>\n" +
            "            <password>{sysPassword}</password>\n" +
            "            <entName>{entName}</entName>\n" +
            "            <entCertType>{entCertType}</entCertType>\n" +
            "            <entCertNum>{entCertNum}</entCertNum>\n" +
            "            <queryReason>{queryReason}</queryReason>\n" +
            "            <queryType>enterprise</queryType>\n" +
            "            <reportType>html格式</reportType>\n" +
            "            <reportModelType>2</reportModelType>\n" +
            "            <reportTables>\n" +
            "               <reportTable>\n" +
            "                  <!--Optional:-->\n" +
            "               </reportTable>\n" +
            "            </reportTables>\n" +
            "            <applyType>?</applyType>\n" +
            "            <remark>?</remark>\n" +
            "            <signServerVendor>?</signServerVendor>\n" +
            "            <signDN>?</signDN>\n" +
            "            <loginRandom>?</loginRandom>\n" +
            "            <localNetwork>?</localNetwork>\n" +
            "            <localDisk>?</localDisk>\n" +
            "            <localCpu>?</localCpu>\n" +
            "         </RtdsRequest>\n" +
            "      </ser:rtdsRequest>\n" +
            "      </soapenvBody>\n" +
            "      </soapenv:Envelope>";

    @Override
    public String toString() {
        return StrUtil.format(templateXMl, BeanUtil.beanToMap(this));
    }

}
